<template>
<!--出库列表-->
  <div id="outStorage">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="出库单编号">
        <el-input v-model="formInline.user" placeholder="请输入出库单编号"></el-input>
      </el-form-item>
      <el-form-item label="审核进度">
        <el-select v-model="formInline.region" placeholder="请选择">
          <el-option label="审核通过" value="shanghai"></el-option>
          <el-option label="驳回申请" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="申请时间">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="开始日期" v-model="formInline.region" style="width: 100%;"></el-date-picker>
        </el-col>
        <el-col class="line" :span="2">--</el-col>
        <el-col :span="11">
          <el-time-picker placeholder="结束时间" v-model="formInline.region" style="width: 100%;"></el-time-picker>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-button icon="el-icon-search" type="" @click="search" round type="primary">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="InStorageFuheAry" style="width: 100%">
      <el-table-column prop="payId" label="序号" width="80">
      </el-table-column>
      <el-table-column prop="payOrderNumber" label="出库单编号" width="180">
      </el-table-column>
<!--      <el-table-column prop="warehouseId" label="出库仓库" width="100">-->
<!--      </el-table-column>-->
      <el-table-column prop="payer" label="出库人">
      </el-table-column>
      <el-table-column prop="reason" label="出库理由">
        <template slot-scope="scope">
          <span v-if="scope.row.reason=='R001-1'">平台出库调拨</span>
        </template>
      </el-table-column>
      <el-table-column prop="totalAmount" label="出库总数">
      </el-table-column>
      <el-table-column prop="totalPrice" label="出库总金额">
      </el-table-column>
      <el-table-column prop="register" label="登记人">
      </el-table-column>
      <el-table-column prop="registerTime" label="登记时间" width="200">
      </el-table-column>
      <el-table-column prop="checkTag" label="审核进度">
        <template slot-scope="scope">
          <span v-if="scope.row.checkTag=='S001-1'" style="color: #409eff">等待审核</span>
          <span v-if="scope.row.checkTag=='S001-2'" style="color:#F56C6C">审核未通过</span>
          <span v-if="scope.row.checkTag=='S001-3'" style="color:#67C23A">审核通过</span>
        </template>
      </el-table-column>
      <!--操作列-->
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
              size="small"
              type="warning"
              round
              icon=""
              @click="FuheStorage(scope.$index,scope.row)">查看详情</el-button>
        </template>
      </el-table-column>

    </el-table>
    <!---分页组件-->
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="pageSizeList"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "OutStorage",
  data(){
    return{
      //入库审核表格
      InStorageFuheAry:[],
      //查询
      formInline: {
        user: '',
        region: ''
      },
      // 当前页号
      currentPage: 1,
      // 当前页大小
      pageSize: 5,
      // 总记录数
      total: 0,
      // 页大小列表
      pageSizeList: [2, 5, 10, 20]
    }
  },
  methods:{
    //查看详情
    FuheStorage(index,row){
      //把id放进页面
      localStorage.setItem("payId",row.payId)
      //去复核页面
      this.$router.push("/OutStorageView")
    },
    // 页大小改变
    handleSizeChange(val) {
      this.pageSize = val
      this.InStorageFuhePage()
    },

    // 页号改变
    handleCurrentChange(val) {
      this.currentPage = val
      this.InStorageFuhePage()
    },
    //分页查询安全库存配置单数据
    async InStorageFuhePage(){
      const {data: res} = await this.$http.post(`/outbound/OutStorageListPage/
				${this.currentPage}/${this.pageSize}`)
      console.log(res);
      this.InStorageFuheAry =res.list
      this.total =res.total
    },
  },
  created() {
    this.InStorageFuhePage()
  }
}
</script>

<style scoped>

</style>